import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class P1443马的遍历 {
    static int[][] map;
    static int[][] dp;
    static int n;
    static int m;
    static class Node{
        int x,y;

        public Node(int x, int y) {
            this.x = x;
            this.y = y;
        }
        
    }
    public static void dfs(Node node,int step){

        if(node.x -2 >= 1 && node.y-1>=1 && dp[node.x -2][node.y-1]==0){
            dp[node.x -2][node.y-1] = 1;
            map[node.x -2][node.y-1] = step + 1;
            dfs(new Node(node.x -2, node.y-1), step+1);
        }
        if(node.x -1 >= 1 && node.y-2>=1 && dp[node.x -1][node.y-2]==0){
            dp[node.x -1][ node.y-2] = 1;
            map[node.x -1][node.y-2] = step + 1;
            dfs(new Node(node.x -1, node.y-2), step+1);
        }
        if(node.x +2 <= n&& node.y-1>=1 && dp[node.x +2][node.y-1]==0){
            dp[node.x +2][node.y-1] = 1;
            map[node.x +2][node.y-1] = step + 1;
            dfs(new Node(node.x +2, node.y-1), step+1);
        }
        if(node.x +2 <= n&& node.y+1<=m && dp[node.x +2][node.y+1]==0){
            dp[node.x +2][node.y+1] = 1;
            map[node.x +2][node.y+1] = step + 1;
            dfs(new Node(node.x +2, node.y+1), step+1);
        }
        if(node.x +1 <= n&& node.y+2<=m && dp[node.x +1][node.y+2]==0){
            dp[node.x +1][node.y+2] = 1;
            map[node.x +1][node.y+2] = step + 1;
            dfs(new Node(node.x +1, node.y+2), step+1);
        }
        if(node.x +1 <= n&& node.y-2>=1 && dp[node.x +1][node.y-2]==0){
            dp[node.x +1][node.y-2] = 1;
            map[node.x +1][node.y-2] = step + 1;
            dfs(new Node(node.x +1, node.y-2), step+1);
        }
        if(node.x -1 >= 1&& node.y+2<=m && dp[node.x -1][node.y+2]==0){
            dp[node.x -1][node.y+2] = 1;
            map[node.x-1][node.y+2] = step + 1;
            dfs(new Node(node.x -1, node.y+2), step+1);
        }
        if(node.x -2 >= 1&& node.y+1<=m && dp[node.x -2][node.y+1]==0){
            dp[node.x -2][node.y+1] = 1;
            map[node.x -2][node.y+1] = step + 1;
            dfs(new Node(node.x -2, node.y+1), step+1);
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        int hi = sc.nextInt();
        int hj = sc.nextInt();
        map = new int[n+1][m+1];
        dp = new int[n+1][m+1];
        dp[hi][hi] = 1;
        dfs(new Node(hi, hj),0);
        for(int i = 1 ;i<=n;i++){
            for(int j = 1; j<=m; j++){
                if(dp[i][j] == 0){
                    System.out.print("-1 ");
                }else{
                    System.out.print(map[i][j]+" ");
                }
            }
            System.out.println();
        }
  
    }
}
